package com.rd.student.jike.class1.sunhao.day0728;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

public class Text2 {
    public static void main(String[] args) throws IOException {
        File file = new File("D:\\gitlianxi\\rd2304" +
                "\\src\\com\\rd\\student\\jike\\class1\\sunhao\\" +
                "day0728\\all.txt");
        FileReader fileReader = new FileReader(file);
        char[] chars = new char[(int)file.length()];
        fileReader.read(chars);
        ArrayList<String> arrayList = new ArrayList<>();
        String str1 = "";
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == '、') {
                arrayList.add(str1);
                str1 = "";
                continue;
            }
            str1 = str1 + chars[i];
        }
//        for (int i=0;i<arrayList.size();i++){
//            System.out.println((String)arrayList.get(i));
//        }
        Random random = new Random();
        while (arrayList.size()!=0){
            int i =random.nextInt(arrayList.size());
            System.out.println((String)arrayList.get(i));
            arrayList.remove(i);
        }
        fileReader.close();
    }
}
